package com.hbpu.encap.map;

import java.util.HashMap;
import java.util.Map;
import java.util.Set;

@SuppressWarnings({"all"})
public class MapExercise {
    public static void main(String[] args) {
        HashMap hashMap = new HashMap();
        hashMap.put(1, new Employee("mike", "01", 15000));
        hashMap.put(2, new Employee("jack", "02", 20000));
        hashMap.put(3, new Employee("john", "03", 16000));

        Set set = hashMap.keySet();

        for (Object o : set) {
            if (((Employee)hashMap.get(o)).getSal() > 18000) {
                System.out.println(o + ":" + hashMap.get(o));
            }
        }

    }
}

class Employee {
    private String name;
    private String id;
    private double sal;

    public Employee(String name, String id, double sal) {
        this.name = name;
        this.id = id;
        this.sal = sal;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public double getSal() {
        return sal;
    }

    public void setSal(double sal) {
        this.sal = sal;
    }

    @Override
    public String toString() {
        return "Employee{" +
                "name='" + name + '\'' +
                ", id='" + id + '\'' +
                ", sal=" + sal +
                '}';
    }
}
